<?php
namespace Home\Controller;
use Think\Controller;
defined('IN_ECTOUCH') or die('Deny Access');
class CommonController extends Controller{

	public  $global = array();
	public  $common_info =  array();
    //TP构造函数,子类同时调用
	public function __construct(){

        /*测试*/
        // $str='user_id=3';
        // $token=M('users')->where($str)->getField('token');
        // $_POST['token']=$token;
        

        
        //初始化
        $common_info=array();
        $common_info['user_id']=0; 
        $common_info['user_name']=''; 
        $common_info['user_rank']=0; 
        $common_info['discount']=1.00;   
        $this->common_info=$common_info;


        
        //检测是否登录 token是否过期
        $Users=D('Users');
        $token=I('post.token');
        if($token)
        {
          $info=$Users->get_userinfo($token);
          if(!$info['user_id'])
          {
          	return_data(20005,'token过期');
          }
          // else if($info['utype']==2&&$info['end_mshop_time']<time())// 检测导游当日是否选择旅行社
          // {
          // 	 return_data(30003,'旅行社选择过期');
          // }
          else
            {
              $this->common_info=$info;
            }


           
        }
      
	}

}
?>
